<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%
	int count = (Integer)((Map)request.getAttribute("resultData")).get("count");
	int pageCount = (int)Math.ceil(((double)count/10.0d));
	int pageNo  = (Integer)((Map)request.getAttribute("resultData")).get("pageNo");
%>    
                    		<h3><p class="left">参与房间话题讨论</p><a class="right" href="javascript:void(0)" onclick="javascript:document.getElementById('publishPostTitle').focus();window.scrollTo(0,document.body.scrollHeight-30);return false;"><i></i>发新帖子</a></h3>
                            <ul>
                                <c:forEach items="${resultData.listdata}" var="item">
                            		<li><p class="td1">
                            		<a href="javascript:void(0)" onclick="showPostInfo('${item.id}');return false;">${item.title }</a><span>（${item.comment_count }）</span>
                            		<c:if test="${item.comment_count >=10 }"><img src="/images/icon_hot.jpg"/></c:if>
                            		</p><p class="td2">${item.user_nick }</p><p class="td3">${item.date} ${item.time}</p>
                            		<c:if test="${roomMaster == 1 || item.user_id==userId}">
                            		<a class="td4" href="javascript:void(0)" onclick="delPost(${item.id})">删除</a>
                            		
                            		</c:if>
                            		<div class="cl"></div>
                            		</li>
                                 </c:forEach>
                             <%if(count ==0){ %>  <img src="/images/tz_bg.jpg"/><%} %>
		                    
	
                            </ul>
                            <ul class="nbList">
                                  <%if(pageNo>1 && pageCount>1){%>
                                  <a href="javascript:void(0)" onclick="showPostList('1');return false;" >首页</a>
                                  <a href="javascript:void(0)" onclick="showPostList('<%=pageNo-1 %>');return false;" >上一页</a>
                                  <%} %>
                                  <%
                                 	 int start = pageNo-4;
                              		if(((start+9) - pageCount)>0){
                              		start = start-((start+9) - pageCount);
                              		
                              		}
                              		if(start<1) start =1;
                                  %>
	
                                <%for(int i = start,j=1 ; i <= pageCount&& j<=10 && pageCount>1;j++,i++){ %>
                                	<a href="javascript:void(0)" onclick="showPostList('<%=i %>');return false;" <%if(i == pageNo){ %>class="on" <%} %>><%=i %></a>
                                <%} %>
                                <%if(pageNo != pageCount && pageCount>1){ %>
		                       <a href="javascript:void(0)" onclick="showPostList('<%=pageNo+1 %>');return false;" >下一页</a>
		                       <a href="javascript:void(0)" onclick="showPostList('<%=pageCount %>');return false;" >末页</a>
								<%}%> 
                                
                            </ul>
                            <div class="inputBox2">
                                <div class="tr1"><p class="td1">标题：</p><input name="title" id="publishPostTitle" type="text" maxlength="20"></div>
                                <div class="tr1"><p class="td1">内容：</p><textarea id="publishPostText" onchange="postWordChange(this)" onkeyup="postWordChange(this)" onmouseup="postWordChange(this)"></textarea></div>
                            	<div class="tr1"><a class="phizOne" href="javascript:void(0)" id="post_message_face"><i class="iconA"></i>表情</a><a href="javascript:void(0)" class="but" onclick="publishPost()"></a><div class="wPrompt">您还可以输入<span class="surplusPostNum">300</span>字</div></div>
                            </div>
                           
